<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

    <title>修改密码</title>

    <link href="/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
    <link href="/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">
    <link href="/layui/css/layui.css" rel="stylesheet"/>
    <link href="/css/personal.css" rel="stylesheet" type="text/css">
    <link href="/css/stepstyle.css" rel="stylesheet" type="text/css">
    <link type="text/css" href="/css/hmstyle.css" rel="stylesheet"/>
    <script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
    <script src="/AmazeUI-2.4.2/assets/js/amazeui.js"></script>
    <script src="/layui/layui.js"></script>
    <script src="/js/common.js" type="text/javascript"></script>
</head>

<body>
<!--头 -->
<th:block th:include="header"/>


<b class="line"></b>
<div class="center">
    <div class="col-main">
        <div class="main-wrap">

            <div class="am-cf am-padding">
                <div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">修改密码</strong> /
                    <small>Password</small></div>
            </div>
            <hr/>
            <!--进度条-->
            <div class="m-progress">
                <div class="m-progress-list">
							<span class="step-1 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">1<em class="bg"></em></i>
                                <p class="stage-name">重置密码</p>
                            </span>
                    <span class="step-2 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">2<em class="bg"></em></i>
                                <p class="stage-name">完成</p>
                            </span>
                    <span class="u-progress-placeholder"></span>
                </div>
                <div class="u-progress-bar total-steps-2">
                    <div class="u-progress-bar-inner"></div>
                </div>
            </div>
            <form class="am-form am-form-horizontal layui-form" id="form1" lay-filter="form1">
                <div class="am-form-group">
                    <label for="user-old-password" class="am-form-label">原密码</label>
                    <div class="am-form-content">
                        <input type="password" name="oldpassword" id="user-old-password" placeholder="请输入原登录密码">
                    </div>
                </div>
                <div class="am-form-group">
                    <label for="user-new-password" class="am-form-label">新密码</label>
                    <div class="am-form-content">
                        <input type="password" name="newpassword1" id="user-new-password"
                               placeholder="由6-12位数字、字母组合">
                    </div>
                </div>
                <div class="am-form-group">
                    <label for="user-confirm-password" class="am-form-label">确认密码</label>
                    <div class="am-form-content">
                        <input type="password" name="newpassword2" id="user-confirm-password"
                               placeholder="请再次输入上面的密码">
                    </div>
                </div>
                <div class="info-btn">
                    <div class="am-btn am-btn-danger" id="save">保存修改</div>
                </div>

            </form>

        </div>
        <!--底部-->
        <th:block th:include="footer"/>

        <aside class="menu">
            <ul>
                <li class="person">
                    <a href="/information">个人中心</a>
                </li>
                <li class="person">
                    <ul>
                        <li><a href="/information">个人信息</a></li>
                        <li><a href="/password">安全设置</a></li>
                    </ul>
                </li>
                <li class="person">
                    <a href="#">我的交易</a>
                    <ul>
                        <li><a href="/order">订单管理</a></li>
                    </ul>
                </li>

                <li class="person">
                    <a href="#">我的小窝</a>
                    <ul>
                        <li><a href="">收藏</a></li>
                        <li><a href="">足迹</a></li>
                    </ul>
                </li>

            </ul>

        </aside>
    </div>
</div>

<script>
    layui.use(["layer", "form"], function () {
        var layer = layui.layer;
        var $ = layui.jquery;
        var form = layui.form;

        $("#save").on("click", function () {
            var data = form.val("form1")
            console.log(data);
             if (!data.oldpassword || !data.newpassword1 || !data.newpassword2) {
                layer.msg("密码不能为空");
                return false;
            } else if (data.newpassword1 !== data.newpassword2) {
                layer.msg("两次密码输入不一致");
                return false;
            } else {
                // method="post" action="/personal/resetPassword"

                $.post("/personal/resetPassword", data, function () {
                    layer.msg("修改成功，请您重新登录");

                });
            }
        });

    });
</script>
</body>

</html>